//
// Created by 25429 on 2020/8/7.
//
#include "task_limit_up_timed_sell.h"

void task_limit_up_timed_sell::init() {
    m_phase = LIMIT_UP_PHASE::WAIT_SOME_TIME;
    m_trade_time = AM_09_31;
}

void task_limit_up_timed_sell::on_md_l2_mkt(const SiriusMDRspMarketField &mkt) {
//    m_last_mkt = mkt;
//    if (mkt.time >= AM_09_30) {
//        switch (m_phase) {
//            case LIMIT_UP_PHASE::WAIT_SOME_TIME:
//                if (mkt.time > m_trade_time) {
//                    if (mkt.last_price < m_stock_info.limit_up_price) {
//                        order_sell();
//                    }
//                    m_phase = LIMIT_UP_PHASE::STOP;
//                }
//                break;
//            default:
//                break;
//        }
//    }
}

void task_limit_up_timed_sell::init(int time) {
    strategy_task::init();

    m_phase = LIMIT_UP_PHASE::WAIT_SOME_TIME;
    m_trade_time = time;

    util::Singleton<my_log>::Instance()->add_log(m_log_title
                                                 + "[m_target_volume]" + to_string(m_target_volume)
                                                 + "[m_trade_time]" + to_string(m_trade_time));

}
